<extend name="Public/base"/>

<block name="body">
	<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
	<div class="main-title">
		<h2>{:isset($album['id'])?'编辑':'新增'}专辑</h2>
	</div>
 
			<form action="{:U()}" method="post" class="form-horizontal">
			
					<div class="form-item">
						<label class="item-label">名称</label>
						<div class="controls">
								<input type="text" class="text input-large"
	name="title" id="title" value="{$album.title|default=''}"> 
						</div>
					</div>
					<div class="form-item"><label class="item-label">归属游戏<span
		class="check-tips">（归属游戏）</span></label>
	<div class="controls"><select name="game_id">
		<volist name="games" id="game">
		<option value="{$game.id}"<eq name="album['game_id']"
			value="$game.id"> selected</eq>>{$game.title_show}</option>
		</volist>
	</select></div>
	</div>
				 <div class="form-item">
						<label class="item-label">标签</label>
						<div class="controls">
									<input type="text" class="text input-large"
	name="tags" id="tags" value="{$album.tags|default=''}"> 
						</div>
					</div>
					<div class="form-item">
						<label class="item-label">描述</label>
						<div class="controls">
							<label class="textarea input-large">
								<textarea name="description">{$album.description|default=''}</textarea>
							</label>
						</div>
					</div>
				 <div class="form-item">
					<div class="controls">
						<label class="item-label">专辑图标</label>
						<input type="file" id="upload_picture">
						<input type="hidden" name="cover" id="cover" value="{$album['cover']|default=''}"/>
						<div class="upload-img-box">
						<notempty name="album['cover']">
							<div class="upload-pre-item"><img src="__ROOT__{$album.cover|get_cover='url'}"/></div>
						</notempty>
						</div>
					</div>
					</div>
					 	<script type="text/javascript">
					//上传图片
				    /* 初始化上传插件 */
					$("#upload_picture").uploadify({
				        "height"          : 30,
				        "swf"             : "__STATIC__/uploadify/uploadify.swf",
				        "fileObjName"     : "download",
				        "buttonText"      : "上传图片",
				        "uploader"        : "{:U('File/uploadAblumPic',array('session_id'=>session_id()))}",
				        "width"           : 120,
				        'removeTimeout'	  : 1,
				        'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
				        "onUploadSuccess" : uploadAblumPic,
				        'onFallback' : function() {
				            alert('未检测到兼容版本的Flash.');
				        }
				    });
					function uploadAblumPic(file, data){
				    	var data = $.parseJSON(data);
				    	var src = '';
				        if(data.status){
				        	$("#cover").val(data.id);
				        	src = data.url;
				        	$("#cover").parent().find('.upload-img-box').html(
				        		'<div class="upload-pre-item"><img src="' + src + '"/></div>'
				        	);
				        } else {
				      
				        	updateAlert(data.info);
				        	setTimeout(function(){
				                $('#top-alert').find('button').click();
				                $(that).removeClass('disabled').prop('disabled',false);
				            },1500);
				        }
				    }
					</script>
		 
				<!-- 高级 -->
			 

				<div class="form-item">
					<input type="hidden" name="id" value="{$album.id|default=''}">
					<button type="submit" id="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">确 定</button>
					<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
				</div>
			</form>
	 
</block>

<block name="script">
	<script type="text/javascript">
		//导航高亮
		highlight_subnav('{:U('Game/index')}');
	</script>
</block>
